# -*- coding: utf-8 -*-
from django.urls import path
from .views.home_view import HomeView
from .views.dashboard_view import DashboardView
from .views.auth_views import login_view, signup_view, logout_view
from .views.admin_views import admin_dashboard_view, user_management_view, data_management_view
from .views.user_charts_views import (upload_file, user_settings_view)
from accounts.views.basic_stats_view import BasicStatsView
from accounts.views.interest_analysis_view import InterestAnalysisView
from .views.personality_analysis_view import PersonalityAnalysisView
from .views.religious_analysis_view import ReligiousAnalysisView
from .views.fashion_analysis_view import FashionAnalysisView
from .views.risk_analysis_view import RiskAnalysisView
from .views.correlation_analysis_view import CorrelationAnalysisView
from .views.supper_view import (
    user_manage_view, role_manage_view,
    add_user_view, edit_user_view, delete_user_view,
    add_role_view, edit_role_view, delete_role_view,
    data_upload_view, data_manage_view
)
from .views.api_views import get_data_detail

# 通用路由
base_urlpatterns = [
    path('', HomeView.as_view(), name='home'),
    path('home/', HomeView.as_view(), name='home'),
    path('dashboard/', DashboardView.as_view(), name='dashboard'),
]

# 通用路由
auth_urlpatterns = [
    path('signup/', signup_view, name='signup'),
    path('login/', login_view, name='login'),
    path('logout/', logout_view, name='logout'),
    path('upload/', upload_file, name='upload'),
]

# 用户端路由
user_urlpatterns = [
    # path('dashboard/', dashboard_redirect_view, name='dashboard_redirect'),
    # path('user/dashboard/', user_dashboard_view, name='user_dashboard'),
    path('user/settings/', user_settings_view, name='user_settings'),
]

# 管理端路由
admin_urlpatterns = [
    path('admin/dashboard/', admin_dashboard_view, name='admin_dashboard'),
    path('admin/users/', user_management_view, name='user_management'),
    path('admin/data/', data_management_view, name='data_management'),
]

# 超级管理员路由
supper_urlpatterns = [
    path('supper/users/', user_manage_view, name='user_manage'),
    path('supper/users/add/', add_user_view, name='add_user'),
    path('supper/users/edit/<int:user_id>/', edit_user_view, name='edit_user'),
    path('supper/users/delete/<int:user_id>/', delete_user_view, name='delete_user'),
    path('supper/roles/', role_manage_view, name='role_manage'),
    path('supper/roles/add/', add_role_view, name='add_role'),
    path('supper/roles/edit/<int:role_id>/', edit_role_view, name='edit_role'),
    path('supper/roles/delete/<int:role_id>/', delete_role_view, name='delete_role'),
    path('supper/data/upload/', data_upload_view, name='data_upload'),
    path('supper/data/', data_manage_view, name='data_manage'),
]

# common_urlpatterns
urlpatterns = base_urlpatterns + user_urlpatterns + admin_urlpatterns + auth_urlpatterns + supper_urlpatterns

urlpatterns += [
    path('analysis/basic/', BasicStatsView.as_view(), name='basic_stats'),
    path('analysis/interests/', InterestAnalysisView.as_view(), name='interest_analysis'),
    path('analysis/personality/', PersonalityAnalysisView.as_view(), name='personality_analysis'),
    path('analysis/religious/', ReligiousAnalysisView.as_view(), name='religious_analysis'),
    path('analysis/fashion/', FashionAnalysisView.as_view(), name='fashion_analysis'),
    path('analysis/risk/', RiskAnalysisView.as_view(), name='risk_analysis'),
    path('analysis/correlation/', CorrelationAnalysisView.as_view(), name='correlation_analysis'),

    # API路由
    path('api/data/<int:record_id>/', get_data_detail, name='get_data_detail'),
]
